﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Manage/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QianBuo.Lottery.Web.Areas.Manage.Models.SchemeModels.SchemeModel>" %>
<%@ Import Namespace="Code.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	购彩明细
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <% Html.DisableClientValidation(); %>
        <% Html.BeginForm(new { ID = "SchemeSerchForm"},null); %>
        <%if (Request["ReturnUrl"] != null){%>
        <a class="a_blue" href='<%=Request["ReturnUrl"] %>'>&gt;&gt;返回</a>
        <%} %>
            <table class="table" width="100%">
                <tr class="th"><th colspan="5" align="left">查找条件</th></tr>
                <tr>
                    <td>
                        彩种：<%=Html.DropDownListFor(p=>p.Serch.LotteryType,Model.LotteryTypes.Each(p=>p.Selected=Model.Serch.LotteryType.ToString()==p.Value)) %>
                    </td>
                    <td>
                        元角模式：<%=Html.DropDownListFor(p=>p.Serch.Ratio,Model.Ratios.Each(p=>p.Selected=Model.Serch.Ratio.ToString()==p.Value)) %>
                    </td>
                    <td>
                        奖金模式：<%=Html.DropDownListFor(p=>p.Serch.WinModel,Model.WinModels.Each(p=>p.Selected=Model.Serch.WinModel.ToString()==p.Value)) %>
                    </td>
                    <td>
                        状态：<%=Html.DropDownListFor(p=>p.Serch.State,Model.States.Each(p=>p.Selected=Model.Serch.State.ToString()==p.Value)) %>
                    </td>
                    <td>
                        追号：<%=Html.DropDownListFor(p=>p.Serch.IsChaseTask,Model.IsChaseTasks.Each(p=>p.Selected=Model.Serch.IsChaseTask.ToString()==p.Value)) %>
                    </td>
                </tr>
                <tr>
                    <td>
                        用户：<%=Html.TextBoxFor(p => p.Serch.UserName, new { @class = "text100" }) %>
                    </td>
                    <td>
                        期号：<%=Html.TextBoxFor(p => p.Serch.IssueName, new { @class = "text80" }) %>
                    </td>
                    <td>
                        时间：<%=Html.TextBoxFor(p => p.Serch.StartTime, new { @class = "text80", onclick = "WdatePicker()" })%>
                    </td>
                    <td>
                        至：<%=Html.TextBoxFor(p => p.Serch.EndTime, new { @class = "text80", onclick = "WdatePicker()" })%>
                    </td>
                    <td>
                        <input type="submit" value="查找"  />
                    </td>
                </tr>
                <%if(!ViewData.ModelState.IsValid) {%>
                    <tr>
                        <td colspan="5">
                            <%=Html.ValidationSummary() %>
                        </td>
                    </tr>
                <%} %>
            </table>
            <%=Html.HiddenFor(p=>p.PageSize) %>
        <% Html.EndForm(); %>
        <p />
        <table width="100%" class="table" id="schemes_table">
            <tr class="th"><th width="40px">用户</th><th width="100px">日期</th><th width="76px">彩种</th><th width="80px">期号</th>
            <th width="39px">元角</th><th width="80px">奖金模式</th><th width="80px">方案金额</th><th width="40px">倍数</th><th width="42px">注数</th>
            <th width="50px">状态</th><th width="65px">开奖号码</th><th width="50px">奖金</th><th width="41px">操作</th></tr>
            <% if(Model.Schemes!=null){ foreach (var item in Model.Schemes){%>
            <%var state = (SchemeState)item.State; %>
               <tr id="<%=item.SchemeID %>" class="context_menu">
                    <td id="UserName"><%=item.UserName %></td>
                    <td id="Date" time='<%=item.AddTime.ToString("yyyy-MM-dd") %>'><%=item.AddTime.ToString("MM-dd HH:mm:ss") %></td>
                    <td id="LotteryType"><%=item.LotteryName %></td>
                    <td id="IssueName"><%=item.IssueName %></td>
                    <td id="Ratio"><%=item.RatioName %></td>
                    <td id="WinModel"><%=item.WinModelName %></td>
                    <td align="right"><%=item.SchemeMoney.ToString("F") %></td>
                    <td align="right"><%=item.Multiple %></td>
                    <td align="right"><%=item.SchemeCount %></td>
                    <td id="State"><%=item.StateName %></td>
                    <td><%=item.OpenCode %></td>
                    <td align="right"><%=string.Format("{0:F}",item.WinMoney) %></td>
                    <td>
                        <%=Html.ActionLink("详情", "Detail", new { ID = item.SchemeID.ToString("N"), ReturnUrl = Url.Action("Index",Url.Route( new {Model.Serch,Model.Page,Model.PageSize})), act = Request["act"] ?? "Index", cont = Request["cont"] ?? "Scheme", arst = Request["arst"] }, new { @class = "a_blue" })%>
                    </td>
               </tr>
              <% } %>
              <tr class="sumtr">
                    <td>合计</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td align="right"><%=Model.SumSchems.SchemeMoney.ToString("F") %></td>
                    <td align="right"><%=Model.SumSchems.Multiple%></td>
                    <td align="right"><%=Model.SumSchems.SchemeCount%></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td align="right"><%=string.Format("{0:F}", Model.SumSchems.WinMoney)%></td>
                    <td>&nbsp;</td>
              </tr>
              <tr><td colspan="13"><%=Html.Pager(Model.Page, Model.PageSize, Model.SumCount, "Page", Url.Route(new { Model.Serch, Model.PageSize, ReturnUrl = Request["ReturnUrl"], act = Request["act"] , cont = Request["cont"] , arst = Request["arst"] }), "PageSize")%></td></tr>
              <% }else{ %>
               <tr><td colspan="13">无记录！</td></tr>
              <%} %>
        </table>
    </div>
    <div class="contextMenu" id="Menu_Serch_UserName">
        <ul>
            <li id="Serch_UserName">查找此用户</li>
        </ul>
    </div>
    <div class="contextMenu" id="Menu_Serch_LotteryType">
        <ul>
            <li id="Serch_LotteryType">查找此彩种</li>
        </ul>
    </div>
    <div class="contextMenu" id="Menu_Serch_IssueName">
        <ul>
            <li id="Serch_IssueName">查找此期号</li>
        </ul>
    </div>
    <div class="contextMenu" id="Menu_Serch_Ratio">
        <ul>
            <li id="Serch_Ratio">查找此元角模</li>
        </ul>
    </div>
    <div class="contextMenu" id="Menu_Serch_WinModel">
        <ul>
            <li id="Serch_WinModel">查找此奖金模式</li>
        </ul>
    </div>
    <div class="contextMenu" id="Menu_Serch_State">
        <ul>
            <li id="Serch_State">查找此状态</li>
        </ul>
    </div>
    <div class="contextMenu" id="Menu_Serch_Date">
        <ul>
            <li id="Serch_Date">查找此日期</li>
        </ul>
    </div>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="StyleAndScript" runat="server">
    <script src='<%=Url.Content("~/Scripts/jquery.contextmenu.r2.js") %>' type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#Serch_State").removeClass("input-validation-error");
            $("#SchemeSerchForm").submit(function () {
                var str = $("#Serch_IssueName").val();
                var rs = true;
                if (str.length > 0)
                    rs = $("#Serch_LotteryType").val().length > 0;
                if (!rs)
                    alert("安期号查找必须选择彩种");
                return rs;
            });
            $("tr.context_menu").mouseover(function () {
                $(this).addClass("selected");
            }).mouseout(function () {
                $(this).removeClass("selected");
            }).css({ cursor: "default" });
            var binds = {
                'Serch_UserName': function (r) {
                    $("#Serch_UserName").val($(r).text());
                },
                'Serch_LotteryType': function (r) {
                    var tp = $("#Serch_LotteryType option").attr("selected", false);
                    var txt = $(r).text();
                    $("#Serch_LotteryType option:contains(" + txt + ")").attr("selected", true);
                },
                'Serch_IssueName': function (r) {
                    var tp = $("#Serch_LotteryType option").attr("selected", false);
                    var txt = $(r).parent().find("#LotteryType").text();
                    $("#Serch_LotteryType option:contains(" + txt + ")").attr("selected", true);
                    $("#Serch_IssueName").val($(r).text());
                },
                'Serch_Ratio': function (r) {
                    var tp = $("#Serch_Ratio option").attr("selected", false);
                    var txt = $(r).text();
                    $("#Serch_Ratio option:contains(" + txt + ")").attr("selected", true);
                },
                'Serch_WinModel': function (r) {
                    var tp = $("#Serch_WinModel option").attr("selected", false);
                    var txt = $(r).text();
                    $("#Serch_WinModel option:contains(" + txt + ")").attr("selected", true);
                },
                'Serch_State': function (r) {
                    var tp = $("#Serch_State option").attr("selected", false);
                    var txt = $(r).text();
                    $("#Serch_State option:contains(" + txt + ")").attr("selected", true);
                },
                'Serch_Date': function (r) {
                    var txt = $(r).attr("time");
                    $("#Serch_StartTime").val(txt);
                    $("#Serch_EndTime").val(txt);
                }
            };
            $("tr.context_menu td[id]").each(function (item) {
                var item = $(this);
                var p1 = "Menu_Serch_" + this.id;
                var p2 = "Serch_" + this.id;
                var op = {};
                op[p2] = binds[p2];
                item.contextMenu(p1, { bindings: op });
            });
        });
    </script>
<style type="text/css">
    .sumtr{ color:Red;}
</style>
</asp:Content>
